Index: template/common.html =================================================================== RCS file: /usr/local/cvsroot/pgweb/portal/template/common.html,v retrieving revision 1.37 diff -c -r1.37 common.html *** template/common.html 12 Mar 2007 16:00:46 -0000 1.37 --- template/common.html 19 Mar 2007 09:00:18 -0000 *************** *** 18,23 **** --- 18,26 ---- + + {extra_header_data} + Index: template/download.html =================================================================== RCS file: /usr/local/cvsroot/pgweb/portal/template/download.html,v retrieving revision 1.10 diff -c -r1.10 download.html *** template/download.html 18 Mar 2007 17:55:59 -0000 1.10 --- template/download.html 19 Mar 2007 09:00:18 -0000 *************** *** 16,28 ****

func_lang("Download PostgreSQL from the primary site")

func_lang("We think these mirrors are near you:")

! --- 16,37 ----

func_lang("Download PostgreSQL from the primary site")

+ +

func_lang("You have used this mirror before:")

+

+ {urlh} +

+

Your download will start automatically from this mirror in 5 seconds unless you select + another mirror in the list below.

+ +

func_lang("We think these mirrors are near you:")

{country}
{country}
http | ftp
 
 
! *************** *** 38,44 **** ! --- 47,53 ---- ! Index: system/redir.php =================================================================== RCS file: /usr/local/cvsroot/pgweb/portal/system/redir.php,v retrieving revision 1.5 diff -c -r1.5 redir.php *** system/redir.php 12 Mar 2007 14:51:43 -0000 1.5 --- system/redir.php 19 Mar 2007 09:00:18 -0000 *************** *** 2,8 **** require_once './global/settings.php'; // Get the URL and hostname ! $url = urldecode($_SERVER['QUERY_STRING']); $bits = parse_url($url); $scheme = $bits['scheme']; $host = $bits['host']; --- 2,18 ---- require_once './global/settings.php'; // Get the URL and hostname ! if (isset($_GET['url'])) { ! $url = $_GET['url']; ! if (isset($_GET['setmir']) && isset($_GET['typ'])) { ! if ($_GET['typ'] == 'h' || $_GET['typ'] == 'f') { ! setcookie('dlmirror', intval($_GET['setmir']), time()+60*60*24*300); ! setcookie('dlmirrortype', $_GET['typ'], time()+60*60*24*300); ! } ! } ! } ! else ! $url = urldecode($_SERVER['QUERY_STRING']); $bits = parse_url($url); $scheme = $bits['scheme']; $host = $bits['host']; Index: system/page/mirrors.php =================================================================== RCS file: /usr/local/cvsroot/pgweb/portal/system/page/mirrors.php,v retrieving revision 1.13 diff -c -r1.13 mirrors.php *** system/page/mirrors.php 18 Mar 2007 17:55:59 -0000 1.13 --- system/page/mirrors.php 19 Mar 2007 09:00:18 -0000 *************** *** 11,16 **** --- 11,22 ---- function Render() { $file = isset($_GET['file'])?$_GET['file']:''; + if (isset($_COOKIE['dlmirror']) && isset($_COOKIE['dlmirrortype'])) { + $lastmirrid = intval($_COOKIE['dlmirror']); + $lastmirrtype = $_COOKIE['dlmirrortype']; + } + else + $lastmirrid = -1; $this->tpl->touchBlock('ftp_mirror_greeting'); *************** *** 18,24 **** $this->tpl->setVariable('file', htmlentities($file)); ! $rs = $this->pg_query("SELECT CASE WHEN mirror_index = 0 THEN ''::text ELSE mirror_index::text END || '.' || country_code || '.postgresql.org' AS hostname, host_port AS port, host_path AS path, country_name AS country, country_code, alternate_protocol FROM mirrors WHERE mirror_type='ftp' AND mirror_active AND NOT mirror_private AND mirror_dns AND mirror_last_rsync > (now() - '48 hrs'::interval) ORDER BY country_name, alternate_protocol DESC, mirror_index"); if (pg_num_rows($rs) == 0) throw new Exception('No mirrors were found'); --- 24,30 ---- $this->tpl->setVariable('file', htmlentities($file)); ! $rs = $this->pg_query("SELECT CASE WHEN mirror_index = 0 THEN ''::text ELSE mirror_index::text END || '.' || country_code || '.postgresql.org' AS hostname, host_port AS port, host_path AS path, country_name AS country, country_code, alternate_protocol, id FROM mirrors WHERE mirror_type='ftp' AND mirror_active AND NOT mirror_private AND mirror_dns AND mirror_last_rsync > (now() - '48 hrs'::interval) ORDER BY country_name, alternate_protocol DESC, mirror_index"); if (pg_num_rows($rs) == 0) throw new Exception('No mirrors were found'); *************** *** 35,41 **** $this->tpl->setVariable(array( 'url' => urlencode('ftp://ftp' . $mirror['hostname'] . (0 < intval($mirror['port'])? ':' . $mirror['port']: '') . $mirror['path'] . $mirror['file']), 'img' => str_replace(' ', '', $mirror['country']) . '.gif', ! 'country' => ucwords($mirror['country']) )); if ($mirror['alternate_protocol'] == 't') $this->tpl->setVariable('httpurl', 'http://ftp' . $mirror['hostname'] . $mirror['path'] . $mirror['file']); --- 41,48 ---- $this->tpl->setVariable(array( 'url' => urlencode('ftp://ftp' . $mirror['hostname'] . (0 < intval($mirror['port'])? ':' . $mirror['port']: '') . $mirror['path'] . $mirror['file']), 'img' => str_replace(' ', '', $mirror['country']) . '.gif', ! 'country' => ucwords($mirror['country']), ! 'mirid' => $mirror['id'] )); if ($mirror['alternate_protocol'] == 't') $this->tpl->setVariable('httpurl', 'http://ftp' . $mirror['hostname'] . $mirror['path'] . $mirror['file']); *************** *** 52,57 **** --- 59,86 ---- $this->tpl->parse('std_mirror_row_loop'); } } + if ($lastmirrid == $mirror['id']) { + // used this mirror the last time + if ($lastmirrtype == 'f') + $host = 'ftp://ftp' . $mirror['hostname']; + elseif ($lastmirrtype == 'h') { + if ($mirror['alternate_protocol'] == 't') + $host = 'http://ftp' . $mirror['hostname']; + else + continue; // requested http, but http no longer available + } + else + continue; // Unknown type, so don't show it at all + + $url = $host . (0 < intval($mirror['port'])? ':' . $mirror['port']: '') . $mirror['path'] . $mirror['file']; + $this->tpl->setVariable(array( + 'url' => urlencode($url), + 'urlh' => htmlentities($host) + )); + $this->tpl->parse('last_mirror_block'); + + $this->tpl->setVariable('extra_header_data', ''); + } } // Add some empty cells if needed
{country}
{country}
http | ftp
 
 
{country}
{country}
http | ftp
 
 
{country}
{country}
http | ftp